from typing import Any, Optional
from utils.responseSchema import ResponseModel


class ResponseUtil:
    @staticmethod
    def success(*, data: Any = None, msg: str = "操作成功") -> ResponseModel:
        return ResponseModel(
            code=200,
            msg=msg,
            data=data
        )

    @staticmethod
    def error(*, code: int = 400, msg: str = "操作失败", data: Any = None) -> ResponseModel:
        return ResponseModel(
            code=code,
            msg=msg,
            data=data
        )